<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
	<link rel="stylesheet" href="../../css/frame1.css">
    <script src="../../script/data.js"></script>
    <script src="../../script/api.js"></script>
</head>
<body>
	<script>
apiready = function(){
    flash();
    document.getElementById('news').style.marginTop = api.winHeight/2.5+'px';
    
    airticle();
   

    api.setRefreshHeaderInfo({
        visible: true,
        loadingImg: 'widget://image/refresh.png',
        bgColor: '#ccc',
        textColor: '#fff',
        textDown: '下拉刷新...',
        textUp: '松开刷新...',
        showTime: true
    }, function(ret, err){
        airticle();
        api.refreshHeaderLoadDone();
        //在这里从服务器加载数据，加载完成后调用api.refreshHeaderLoadDone()方法恢复组件到默认状态

    });
''
}

	function flash(){
    // 创建两个数组，分别储存图片的地址和图片对应的aid
    var picadr = [],indexarr = [];
    for(x in flashobj){
        picadr.push(flashobj[x].imgurl);
        indexarr.push(flashobj[x].aid);
    }



	var UIScrollPicture = api.require('UIScrollPicture');
UIScrollPicture.open({
    rect: {
        x: 0,
        y: 0,
        w: api.winWidth,
        h: api.winHeight / 2.5
    },
    data: {
        paths: picadr,
        captions: ['标题1', '标题2', '标题3', '标题4', '标题5', '标题6', '标题7']
    },
    styles: {
        caption: {
            height: 35,
            color: '#FFFFFF',
            size: 13,
            bgColor: 'rgba(0,0,0,0.2)',
            position: 'overlay'
        },
        indicator: {
            align: 'center',
            color: '#FFFFFF',
            activeColor: '#DA70D6'
        }
    },
    placeholderImg: 'widget://res/slide1.jpg',
    contentMode: 'scaleToFill',
    interval: 3,
    fixedOn: api.frameName,
    loop: true,
    fixed: false
}, function(ret, err){
	// eventType:'click',
    if( ret.status ){
         // alert( JSON.stringify( ret ) );
        if (ret.eventType == 'click') {
        	api.setPrefs({
	    		key: 'pic',
	    		value: indexarr[ret.index]
			}),
			api.openWin({
	   	 		name: 'arc',
	    		url: '../pic.html'
			})
        }
        

    }else{
         alert( JSON.stringify( err ) );
    }






});
}
	</script>


<ul id="news">
	<li data-index='1'>
		<img src="../../image/frame1/laozhaopian.jpg" >
		<h4>习近平曾对考生说：考上可喜 考不上也不用悲观</h4>
	</li>
	<li data-index='2'>
		<img src="../../image/frame1/caochang.jpg" >
		<h4>全国多校被曝“毒跑道” 专家：“达标”非国家标准</h4>
	</li>
	<li data-index='3'>
		<img src="../../image/frame1/gaokao.jpeg" >
		<h4>高考恢复40年：录取率从50%高歌猛进至76%后微降</h4>
	</li>
	<li data-index='4'>
		<img src="../../image/frame1/sundeng.png" >
		<h4>孙俪邓超庆结婚五周年 儿女不看镜头</h4>
	</li>
	<li data-index='5'>
		<img src="../../image/frame1/huangma.png" >
		<h4>皇马引援名单全是世界级 这三人都来画面不敢想</h4>
	</li>
	<li data-index='6'>
		<img src="../../image/frame1/nubia.jpg" >
		<h4>nubia Z11 Max续航大不同 发布直播中</h4>
	</li>
	<li data-index='7'>
		<img src="../../image/frame1/gaotie.jpg" >
		<h4>高铁时速能否恢复350km？如果恢复又意味着什么？</h4>
	</li>
	<li data-index='8' class="tu">
		<h3>中国最富的15座城市</h3>
		<img src="../../image/frame1/cheng1.jpg" >
		<img src="../../image/frame1/cheng2.jpg" >
		<img src="../../image/frame1/cheng3.jpg" >
	</li>
</ul>

<script>
    function airticle(){
        for(x in hotinfo){
            var str = '<li data-index="'+hotinfo[x].aid+'"><img src="'+hotinfo[x].imgurl+'" ><h4>'+hotinfo[x].title+'</h4></li>';
            $api.prepend(document.getElementById('news'),str);
        }
    

    var lis = $api.domAll('#news li');
    for(var i=0;i<lis.length;i++){
        // 给每个li都加一个单击事件
        lis[i].onclick = function(){
            var index = this.getAttribute('data-index');
            // 将信息存到本地
            api.setPrefs({
                key: 'aid',
                value: index
            });
            // 打开新窗口，用来展示这个标题对应的文章内容
            api.openWin({
                name: 'art',
                url: '../article.html'
            });
        }
    }
    for(var i=10;i<lis.length;i++){
        lis[i].style.display='none';
    }
}
</script>






</body>
</html>